package ph.loong.deliveryman.ui.wallet

import android.os.Bundle
import android.support.v7.widget.GridLayoutManager
import android.view.View
import com.administrator.kotlindemo1.utils.showToast
import com.chad.library.adapter.base.BaseQuickAdapter
import deliveryman.loong.ph.deliveryman.R
import kotlinx.android.synthetic.main.activity_bill_detail.*
import ph.loong.deliveryman.adapter.ChooseBillAdapter
import ph.loong.deliveryman.base.BaseActivity

//账单明细
class BillDetailActivity : BaseActivity(), BaseActivity.onRightClickListener, BaseQuickAdapter.OnItemChildClickListener {

    var mList: ArrayList<String> = ArrayList()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_bill_detail)
        setTitle("账单明细")
        setRightTitle("筛选")
        super.setOnRightImgClickListener(this)

        initView()
    }

    private fun initView() {
        choose_blank_layout.setOnClickListener({
            choose_layout.visibility = View.GONE
        })
    }


    override fun onRightImgClick() {
        recycler.layoutManager = GridLayoutManager(this, 2)
        val adapter = ChooseBillAdapter()
        recycler.adapter = adapter
        adapter.notifyDataSetChanged()
        mList.clear()
        mList.add("全部明细")
        mList.add("金额提现")
        mList.add("结算收入")
        mList.add("提现手续费")
        adapter.setNewData(mList)


        //显示筛选框
        choose_layout.visibility = View.VISIBLE

        adapter.setOnItemChildClickListener(this)
    }


    override fun onItemChildClick(adapter: BaseQuickAdapter<*, *>?, view: View?, position: Int) {
        showToast(mList[position])
        choose_layout.visibility = View.GONE
    }
}
